import { Component, OnInit } from '@angular/core';
import { GlobalVariable } from '../../../global.config';
import { HttpRequest } from "../../../service/httpRequest";
import { PageModel } from "../../../model/page-model";
import { flyIn } from '../../../animations/fly-in';

@Component({
  selector: 'app-record',
  templateUrl: './record.component.html',
  styleUrls: ['./record.component.css'],
  animations: [
    flyIn
  ]
})
export class RecordComponent implements OnInit {

  tool = GlobalVariable.tooltip;
  data:any;
  pageModel = new PageModel();
  oo:any = {devicename:'',province:'',city:'',district:''};
  page:number = 1;
  constructor(private httpRequest:HttpRequest) { }

  ngOnInit() {
    this.getData();
  }

  getData(){
    this.httpRequest.sendGet('guzhang/page',{
      'page': this.page,
      'size': this.pageModel.itemsPerPage,
      'province':this.oo.province,
      'city':this.oo.city,
      'area':this.oo.district,
      'device_name':this.oo.devicename
    }).subscribe(res => {
      this.data = res.result.aaData;
      this.pageModel.setPage({'iTotalRecords':res.result.iTotalRecords});
    },err => console.log(err));
  }

}
